package com.demo.enums;

/**
 * 性别枚举
 * 
 *
 */
public enum Gender implements BaseEnum<Gender> {

    NONE(-1, "错误"), 
    MAN(1, "男"), 
    WOMEN(2, "女");

    private int code;

    private String message;

    private Gender(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public static Gender parse(int code) {
        for (Gender st : Gender.values()) {
            if (st.getCode() == code) {
                return st;
            }
        }
        return NONE;
    }

}
